package top.hymsk.ecommerce.pojo.DTO;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import top.hymsk.ecommerce.pojo.DO.OrderBuyerOverviewDO;
import top.hymsk.ecommerce.utils.TimeUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 花于陌上开
 */
@Data
public class OrderBuyerOverviewListDTO {
    List<OrderBuyerOverviewDTO> orderList;
    Integer total;

    public OrderBuyerOverviewListDTO(List<OrderBuyerOverviewDO> orderDOList,Integer number) {
        orderList=orderDOList.stream().map(OrderBuyerOverviewDTO::new).collect(Collectors.toList());
        this.total=number;
    }
}
@Data
@AllArgsConstructor
@NoArgsConstructor
class OrderBuyerOverviewDTO {
    Integer orderId;
    String createTime;
    Integer status;
    Double amount;
    String firstFilePath;

    public OrderBuyerOverviewDTO(OrderBuyerOverviewDO orderDO) {
        this.orderId = orderDO.getOrderId();
        this.createTime = TimeUtils.formatTime(orderDO.getCreateTime());
        this.status = orderDO.getStatus();
        this.amount = orderDO.getAmount();
        this.firstFilePath=orderDO.getFirstFilePath();
    }
}